/**
 * 
 */
package com.great.meal.search.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * @author lenovo
 *
 */
@Entity
@Table(name="t_hotel")
public class Hotel implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7515906428225461924L;
	private Long hotelId;
	private String hotelAccount;
	private String hotelPassword;
	private String hotelName;
	private String location;
	private String sendScope; //送餐范围
	private Date startTime;
	private Date EndTime;
	private Integer honour;
	private String hotelBoss;
	private String phone;
	private Set<Dish> dishes;
	private Boolean status; //true 可用.false不可用
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getHotelId() {
		return hotelId;
	}
	public void setHotelId(Long hotelId) {
		this.hotelId = hotelId;
	}
	
	public String getHotelAccount() {
		return hotelAccount;
	}
	public void setHotelAccount(String hotelAccount) {
		this.hotelAccount = hotelAccount;
	}
	
	public String getHotelName() {
		return hotelName;
	}
	public void setHotelName(String hotelName) {
		this.hotelName = hotelName;
	}
	
	public String getLocation() {
		return location;
	}
	public void setLocation(String location) {
		this.location = location;
	}
	
	public String getSendScope() {
		return sendScope;
	}
	public void setSendScope(String sendLocation) {
		this.sendScope = sendLocation;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="starttime")
	public Date getStartTime() {
		return startTime;
	}
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="endtime")
	public Date getEndTime() {
		return EndTime;
	}
	public void setEndTime(Date endTime) {
		EndTime = endTime;
	}
	
	public Integer getHonour() {
		return honour;
	}
	public void setHonour(Integer honour) {
		this.honour = honour;
	}
	
	public String getHotelBoss() {
		return hotelBoss;
	}
	public void setHotelBoss(String hotelBoss) {
		this.hotelBoss = hotelBoss;
	}
	
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	@OneToMany(cascade = CascadeType.ALL)
	public Set<Dish> getDishes() {
		return dishes;
	}
	public void setDishes(Set<Dish> dishes) {
		this.dishes = dishes;
	}
	
	public Boolean getStatus() {
		return status;
	}
	public void setStatus(Boolean status) {
		this.status = status;
	}
	
	public String getHotelPassword() {
		return hotelPassword;
	}
	public void setHotelPassword(String hotelPassword) {
		this.hotelPassword = hotelPassword;
	}
	@Override
	public boolean equals(Object obj) {
		if(this == obj) return true;
		if(!(obj instanceof Hotel)) return false;
		
		final Hotel hotel = (Hotel)obj;
		if(!(hotel.getStatus().equals(getStatus()))) return false;
		if(!(hotel.getDishes().equals(getDishes()))) return false;
		if(!(hotel.getEndTime().equals(getEndTime()))) return false;
		if(!(hotel.getStartTime().equals(getStartTime()))) return false;
		if(!(hotel.getHonour().equals(getHonour()))) return false;
		if(!(hotel.getHotelAccount().equals(getHotelAccount()))) return false;
		if(!(hotel.getHotelBoss().equals(getHotelBoss()))) return false;
		if(!(hotel.getHotelId().equals(getHotelId()))) return false;
		if(!(hotel.getHotelName().equals(getHotelName()))) return false;
		if(!(hotel.getLocation().equals(getLocation()))) return false;
		if(!(hotel.getPhone().equals(getPhone()))) return false;
		if(!(hotel.getSendScope().equals(getSendScope()))) return false;
		
		return true;
	}
	
	@Override
	public int hashCode() {
		int result = status != null ? status.hashCode() : 0;
		result = 31 * result + (dishes != null ? dishes.hashCode() : 0);
		result = 31 * result + (hotelId != null ? hotelId.hashCode() : 0);
		result = 31 * result + (hotelAccount != null ? hotelAccount.hashCode() : 0);
		result = 31 * result + (hotelName != null ? hotelName.hashCode() : 0);
		result = 31 * result + (location != null ? location.hashCode() : 0);
		result = 31 * result + (sendScope != null ? sendScope.hashCode() : 0);
		result = 31 * result + (startTime != null ? startTime.hashCode() : 0);
		result = 31 * result + (EndTime != null ? EndTime.hashCode() : 0);
		result = 31 * result + (honour != null ? honour.hashCode() : 0);
		result = 31 * result + (hotelBoss != null ? hotelBoss.hashCode() : 0);
		result = 31 * result + (phone != null ? phone.hashCode() : 0);
		result = 31 * result + (dishes != null ? dishes.hashCode() : 0);
		result = 31 * result + (dishes != null ? dishes.hashCode() : 0);
		result = 31 * result + (dishes != null ? dishes.hashCode() : 0);
		
		return result;
	}
	
	
	
}
